Repository navigation
Conversation
|
|
||
| /// Produces the resulting manifest set for the current table and writes | ||
| /// this attempt's snapshot. | ||
| pub(crate) async fn apply(&mut self, table: &Table) -> Result<ActionCommit> { |
There was a problem hiding this comment.
Seems like we currently have no logic to validate new deletes or overwrite?
There was a problem hiding this comment.
We can add them later before adding the actions that consume MSP
laskoviymishka
left a comment
There was a problem hiding this comment.
It's on the large side, but this is close; I left a couple of comments inline.
Keying each rewrite by ManifestKey rather than path means a retry only redoes the manifests whose inherited values actually moved, and that's the piece the rest of #3417 builds on.
What I'd most like to settle is who decides that a missing delete fails, the action or the filter. I'd like to hear @anoopj's opinion on that thread; a follow-up is fine.
Could the description also mention the to_human_string promotion fix in spec/?
I'll take another look once that thread converges.
| /// Produces the resulting manifest set for the current table and writes | ||
| /// this attempt's snapshot. | ||
| pub(crate) async fn apply(&mut self, table: &Table) -> Result<ActionCommit> { |
There was a problem hiding this comment.
I think this is aligned with the current Java implementation and we are trying to change it for v4. I suggest establishing a separate CommitValidator API. Action execution state can own the validator alongside this producer across retries. This has two advantages:
- The validation can be stateful. So retries can reuse the already validated state.
- Provides a useful seam for introducing v4 specific implementations of validations.
apache/iceberg#18699 may be a useful reference. This is one of the many upcoming changes we are making for validations.
There was a problem hiding this comment.
Thanks for pointing me to the java side PR! I had some thoughts about this a few weeks ago, and my previous thought was caching validated snapshots directly under the MSP and the seam also makes sense to me.
iiuc, we could still address this #3419 ? I'm leaning toward moving validations to another PR since the current PR is already quite large
Merges CTTY's branch and drops the producer this branch carried from apache#3046.
|
@CTTY we put #3585 (
Happy to open either as a PR on top of this once it lands. Both were in the producer #3585 carried before the restack, in case it saves time: the keep rule at https://github.com/jopdorp/iceberg-rust/blob/682a6150b/crates/iceberg/src/transaction/merging.rs#L301-L313 and the sequence number check at https://github.com/jopdorp/iceberg-rust/blob/682a6150b/crates/iceberg/src/transaction/merging.rs#L259-L270. |
|
Hi @jopdorp , thanks for the feedback! I've addressed the first point you mentioned. And I'm planning to address the starting-seq-number issue when we are actually wiring actions with MSP and adding validation methods |
|
@CTTY #3300 (overwrite) sits on this branch now as well, it only builds a
Happy to send a PR into your branch for 1 if you want it. |
JeonDaehong
left a comment
There was a problem hiding this comment.
Re-ran my check at 8a442c6: removing a.parquet now marks its DV deleted (total-delete-files=0). Naming the DV as well under fail_missing_delete_paths removes it once, and removing only b.parquet or appending leaves a's DV alone. The older delete file cleanup (dropDeleteFilesOlderThan) isn't there yet, which is fine as a follow-up.
|
@CTTY one thing from my last comment is still open: the |
|
@CTTY opened CTTY#21 against your branch, it just merges main and resolves the conflict with the per-spec fast append, so you can pull it in if it helps. |
| filtered: HashMap<ManifestKey, FilteredManifest>, | ||
| /// Format version the rewrites were written under. Per spec, v1 entries | ||
| /// cannot inherit sequence numbers, so an upgrade invalidates them. | ||
| format_version: Option<FormatVersion>, |
There was a problem hiding this comment.
We cannot initialize the format version when initializing this struct, because there may be format upgrade that could invalidate our cache
There was a problem hiding this comment.
I see, it's a bit ugly to pass local fields for one retry, how about we just add fields and mutators for snapshot id, uuid, table format, next_manifest_counter. And we could reset these fields before calling filter method.
There was a problem hiding this comment.
Also we could infer minimun table format from inputs.
There was a problem hiding this comment.
Or we could wrap them in sth like a RetryContext.
There was a problem hiding this comment.
a RetryContext or AttemptContext sounds pretty clean, but we still have to store the format version in the ManifestFilterManager to validate against the format_version of the current attempt to make sure we invalidate the cache when format is being upgraded
| // before reading, as Java's ManifestFilterManager does, and read the | ||
| // rest concurrently as `validate_files_not_live` does. | ||
| for source in manifests { | ||
| if source.content != self.content { |
There was a problem hiding this comment.
I think we should return error here?
There was a problem hiding this comment.
Currently I'm passing a list of manifests with mixed contents. We can split the input by content and add new API for each content but it would not really be necessary
- Add MergingSnapshotProducer as a Transaction state to store deleted files - Add ManifestFilterManager to cache the manifests across transaction attempts - Widen removed files' partition values to the current schema's types when building the summary key, as Java's manifest reader does
The removal conditions (content, files to remove, fail_missing_delete_paths, dangling DVs) are fixed at build time; the per-attempt cache has no setter, so after build() the only way to change a manager is filter().
| filtered: HashMap<ManifestKey, FilteredManifest>, | ||
| /// Format version the rewrites were written under. Per spec, v1 entries | ||
| /// cannot inherit sequence numbers, so an upgrade invalidates them. | ||
| format_version: Option<FormatVersion>, |
There was a problem hiding this comment.
I see, it's a bit ugly to pass local fields for one retry, how about we just add fields and mutators for snapshot id, uuid, table format, next_manifest_counter. And we could reset these fields before calling filter method.
| filtered: HashMap<ManifestKey, FilteredManifest>, | ||
| /// Format version the rewrites were written under. Per spec, v1 entries | ||
| /// cannot inherit sequence numbers, so an upgrade invalidates them. | ||
| format_version: Option<FormatVersion>, |
There was a problem hiding this comment.
Also we could infer minimun table format from inputs.
| data_filter: ManifestFilterManager, | ||
| delete_filter: ManifestFilterManager, | ||
| /// Manifests written for the added files, reused across attempts. | ||
| added_manifests: Option<AddedManifests>, |
There was a problem hiding this comment.
Should this be part of MergingIntent?
There was a problem hiding this comment.
No, added_manifests should come from manifest writers that live in the snapshot producer, not tx actions
| filtered: HashMap<ManifestKey, FilteredManifest>, | ||
| /// Format version the rewrites were written under. Per spec, v1 entries | ||
| /// cannot inherit sequence numbers, so an upgrade invalidates them. | ||
| format_version: Option<FormatVersion>, |
There was a problem hiding this comment.
Or we could wrap them in sth like a RetryContext.
- Add PartitionSpec::resolve(schema, partition) -> Result<Struct>, which widens a stored partition value to the type the schema declares now (int -> long, float -> double). build_summary resolves a removed file's partition before rendering the summary key; the unit tests move to spec/partition.rs with it. - Move the snapshot producers' test helpers (data_file, append_to, with_snapshot) into the crate-level test_utils module.
- AttemptContext bundles what one attempt writes against (table, snapshot id, commit UUID, manifest counter, owned artifacts) and allocates manifest paths, so ManifestFilterManager::filter takes it instead of five per-attempt arguments and both producers' added manifests go through the same path allocation. - RemovedFileIdentity::try_of fails for a file that carries a blob range but is not a Puffin file, or carries half a range. The manager keeps the files as named and converts them per attempt, so the error comes out of filter() and cannot be skipped.
| /// Borrowed from the producer for one `apply`, so a helper cannot hold a stale | ||
| /// table across attempts, and every file written is recorded as owned by the | ||
| /// helper that allocates its path. | ||
| pub(crate) struct AttemptContext<'a> { |
There was a problem hiding this comment.
I didn't add builder for this because this is a wrapper struct and all its fields are required
laskoviymishka
left a comment
There was a problem hiding this comment.
fail_missing_delete_paths, the v1 rewrite test and the 0.1_f32 case are in, thanks. One test note inline. From my side this is ready. @blackmwk's threads from today (PartitionSpec::resolve, the Puffin check, the retry state) are still open, and I'd like @anoopj to confirm the conflict validation can wait for #3419.
| .build(), | ||
| delete_filter: ManifestFilterManager::builder() | ||
| .content(ManifestContentType::Deletes) | ||
| .files_to_remove(intent.removed_delete_files()) |
There was a problem hiding this comment.
Following up on my earlier ask for a delete-file removal test: could we add one that removes a Parquet position or equality delete as well? The only test that sets removed_delete_files removes a Puffin DV (merging.rs), so the RemovedFileIdentity::File path for delete files never runs.
Which issue does this PR close?
MergingSnapshotProducer, manifest filtering, reusable added-manifest production; wire terminalCommitStatusreporting and cleanup #3417What changes are included in this PR?
MergingSnapshotProduceras a Transaction state to store deleted filesManifestFilterManagerto cache the manifests across transaction attemptsto the types the current schema declares (
int->long,float->double).A value read from a manifest keeps the literal type it was written with; Java
reads manifests against the current partition type so it never sees the
difference. The real fix belongs in the manifest reader; this is a TODO.
write_added_manifestandAddedManifestsmove tosnapshot/mod.rsso bothproducers share them; the simple producer keeps the per-spec grouping from
fix: support fast append across partition specs #3662 and both producers reject a cached manifest whose partition spec a
concurrent commit removed.
Are these changes tested?
Added unit tests
AI Disclosure
Used Claude, but reviewed them with human eyes